from sqlite3.dbapi2 import Binary
import pandas as pd
import sqlite3
from GTexamlib.imports import *

path_tmp='.'+os.sep+'temp'+os.sep


con = sqlite3.connect("Database.db")
cur = con.cursor()


e=ExamU()
e.get_li_uuid(pd.read_sql('SELECT * FROM question',con),2020,2)
e.df_to_li(pd.read_sql('SELECT * FROM single_sel',con),pd.read_sql('SELECT * FROM multi_sel',con),pd.read_sql('SELECT * FROM essay',con))
e.get_latex()
file_name=e.title

with open(file_name+".txt","w") as f:
    f.write(e.latex)
os.rename(file_name+'.txt',file_name+'.tex')
#os.system("pdflatex test.tex")